<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=2.0, user-scalable=no" /> 
<title><?php echo ($title); ?></title>
<link href="__CSS_MOBILE_PATH__/style.css" type="text/css" rel="stylesheet" />
<script src="__JS_PATH__/jquery-1.8.3.js" type="text/javascript"></script>
</head>
<body>
<div class="ding">
  <h1>欢迎来<?php echo ($configInfo["name"]); ?>手机点餐系统</h1>
</div>
<div id="tou">
<?php if(is_array($actionList)): $i = 0; $__LIST__ = array_slice($actionList,0,2,true);if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><div class="dating" <?php if($key): ?>style="float:right; margin-right:30px;"<?php endif; ?>> <a href="/index.php?g=User&m=Mobile&a=index&id=<?php echo ($v["id"]); ?>">
    <div <?php if($v['id'] == $id): ?>class="dating_n" <?php else: ?>class="dating_n1"<?php endif; ?> >
      <h1><?php echo ($v["name"]); ?></h1>
    </div>
    </a>
<?php if($v['id'] == $id): ?><div class="dating_sj"></div><?php endif; ?>
  </div><?php endforeach; endif; else: echo "" ;endif; ?>
</div>
<div class="content">
<?php if(is_array($viewList)): $i = 0; $__LIST__ = $viewList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><div class="one">
    <h1><?php echo ($v["name"]); ?></h1>
  </div>
  <div class="mid">
    <div class="nav">
      <ul>
	  <?php if(is_array($v['view'])): $i = 0; $__LIST__ = $v['view'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vv): $mod = ($i % 2 );++$i; if($vv['status'] == 4): ?><li class="checkTab red" dataid="<?php echo ($vv["id"]); ?>">
          <h1 class="c"><?php echo ($vv["num"]); ?>号<br />
            整理中</h1>
        </li>
		<?php elseif($vv['status'] == 3): ?>
        <li class="checkTab b" dataid="<?php echo ($vv["id"]); ?>">
          <h1 class="c"><?php echo ($vv["num"]); ?>号<br />
            正使用</h1>
        </li>
		<?php elseif($vv['status'] == 2): ?>
        <li class="checkTab d" dataid="<?php echo ($vv["id"]); ?>">
          <h1 class="c"><?php echo ($vv["num"]); ?>号<br />
            已预订</h1>
        </li>
		<?php else: ?>
		<li class="checkTab no" dataid="<?php echo ($vv["id"]); ?>">
          <h1><?php echo ($vv["num"]); ?>号<br />
          <?php if($vv['chair']): echo ($vv["chair"]); ?>人座<?php else: ?>空闲中<?php endif; ?></h1>
        </li><?php endif; endforeach; endif; else: echo "" ;endif; ?>
      </ul>
    </div>
  </div><?php endforeach; endif; else: echo "" ;endif; ?>
</div>
<script>
	$('.checkTab').click(function(){
		var isClass = $(this).hasClass('no');
		if(isClass){
			var tabId = $(this).attr('dataid');
			$.post('/index.php?g=User&m=Mobile&a=tabPost',{'tabid':tabId},function(re){
				if(re == 2){
					alert('此桌位已被预订，请选择别的桌位。');
				}else if(re == 3){
					alert('此桌位正在使用中，请选择别的桌位。');
				}else if(re == 4){
					alert('此桌位正在整理中，请稍等或选择别的桌位。');
				}else if(re == 1){
					window.location.href='/index.php?g=User&m=Mobile&a=classify';
				}else{
					alert('桌位选择失败！');
				}
			});
		}else{
			var isClassB = $(this).hasClass('b');
			var isClassD = $(this).hasClass('d');
			var isClassRed = $(this).hasClass('red');
			if(isClassB){
				alert('此桌位正在使用中，请选择别的桌位。');
			}else if(isClassD){
				alert('此桌位已被预订，请选择别的桌位。');
			}else if(isClassRed){
				alert('此桌位正在整理中，请稍等或选择别的桌位。');
			}
		}
	});
</script>
  <div id="ly_foot">
	<ul>
		<li><a href="javascript:history.go(-1);"><img src="__IMG_MOBILE_PATH__/b_1.png" width="25" height="25" />返回</a></li>
		<li><a class="footerNav" data-type="menu" tabid="<?php echo ($tabId); ?>" href="javascript:void(0);"><img src="__IMG_MOBILE_PATH__/b_2.png" width="25" height="25" />菜单</a></li>
		<li><a href="/index.php?g=User&m=Mobile&a=recommend"><img src="__IMG_MOBILE_PATH__/b_3.png" width="25" height="25" />推荐</a></li>
		<li><a href="/index.php?g=User&m=Mobile&a=hotMenu"><img src="__IMG_MOBILE_PATH__/b_4.png" width="25" height="25" />热门</a></li>
        <li><a class="footerNav" data-type="already" href="javascript:void(0);"><img src="__IMG_MOBILE_PATH__/b_5.png" width="25" height="25" />已点</a></li>
	</ul>
</div>
<script>
//点菜按钮触发	added by Tony
function addMenu(menuId){
	if(menuId){
		$.post('index.php/User/Mobile/addMenu/',{'u_id':menuId},function(data){
			if(data.status==1){
				alert('点菜成功！');
			}else{
				alert('操作失败！');
			}
		},'json');
	}
}
//脚部菜单绑定事件	added by Tony
$('.footerNav').click(function(){
	var dataType = $(this).attr('data-type');
	if(dataType == 'menu'){
		var tabId = $(this).attr('tabid');
		if(tabId){
			window.location.href="/index.php?g=User&m=Mobile&a=classify&tabid="+tabId;
		}else{
			if(confirm('请您选择桌位')){
				window.location.href="/index.php?g=User&m=Mobile&a=index";
			}
		}
	}else if(dataType =='already'){
		window.location.href="/index.php?g=User&m=Mobile&a=already";
	}
});
</script>
</body>
</html>